package com.xiaoming.mojbackendjudgeservice.codesandbox;


import com.xiaoming.mojbackendjudgeservice.codesandbox.impl.ExampleCodeSandBox;
import com.xiaoming.mojbackendjudgeservice.codesandbox.impl.RemoteSandBox;
import com.xiaoming.mojbackendjudgeservice.codesandbox.impl.ThirdPartCodeSandBox;

/**
 * 代码沙箱工厂(根据字符串类型，返回的对应的沙箱实例）
 */
public class CodeSandBoxFactory {
    public static  CodeSandBox newInstance(String type)
    {
        switch (type)
        {
            case "example" :
                return new ExampleCodeSandBox();
            case "remote" :
                return new RemoteSandBox();
            case "thirdPart" :
                return new ThirdPartCodeSandBox();
            default:
                return new ExampleCodeSandBox();
        }
    }
}
